package cn.itcast;

import org.quartz.*;
import org.quartz.impl.StdSchedulerFactory;

public class MyRunner {
    public static void main(String[] args) throws SchedulerException {
        Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
        JobDetail jb = JobBuilder.newJob(MyJob.class).withIdentity("myJob","group1").
                usingJobData("name","itcast").build();
        //Trigger trigger = TriggerBuilder.newTrigger().withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(5).repeatForever()).build();
        Trigger trigger = TriggerBuilder.newTrigger().withSchedule(CronScheduleBuilder.cronSchedule("0/5 * * * * ?").withMisfireHandlingInstructionFireAndProceed()).build();
        scheduler.scheduleJob(jb,trigger);
        scheduler.start();
    }
}
